from base_page import BasePage
from selenium.webdriver.common.by import By


class BaiduNewsPage(BasePage):
    __NewsUrl = "https://news.baidu.com/"
    __inputSearch = (By.ID,'ww')
    __clickSearch = (By.CSS_SELECTOR,'#s_btn_wr')

    def openPage(self):
        self.driver.get(self.__NewsUrl)

    def search(self,news):
        self.find_element(*self.__inputSearch).send_keys(news)

    def clickBth(self):
        self.find_element(*self.__clickSearch).click()

    def search_news(self, news):
        self.openPage()
        self.search(news)
        self.clickBth()
